<div style="float:left; width:13%; border:1px solid; padding: 5px;">
    <input type="text" placeholder="关键词搜索" />
	<div style="border: 1px solid; padding: 4px; ">
		<select size="100" id="parties_select" style="width:150px;">
    	</select>
    </div>
</div>

<script>
$(document).ready( function(){
	$.ajax({
		url: '/grade/add_options',
		type:'GET',
		dataType: 'json',
		success: function( data){
			$(data).each( function(){
                var opt = $("<option/>").text(this.name).attr("value", this.id);
                $("#parties_select").append(opt);
			})
		},
		error: function(){
			alert("网络出现问题，请稍后重试。");
		}
	});
});

$("#parties_select").change( function(){
	var id=$(this).val();
    $.ajax({
      url: '/grade/feng_guan_zhuan_yuan',
  	  data: 'id='+id,
  	  success: function( data){
        $("#tabs-1").html("<%= escape_javascript(render('grade/feng_guan_zhuan_yuan')) %>");
  	  }
    });

    $.ajax({
      url: '/grade/change_header',
      data: 'id='+id,
      success: function( data){
        var html_content= "<h4>"+data[0]+"，欢迎您，您正在为"+ data[1]+"进行评分。</h4><hr/>"
        $("#header").html( html_content);
        },
      error: function(){
        alert("网络出现问题，请稍后再试。");
      }
    });

    $.ajax({
      url: '/grade/change_right_bar',
      data: 'id='+id,
      success: function(data){
        $("#right_total").html( data[1]+ data[3]);
        $("#right_done").html( data[1]);
        $("#right_undone").html( data[3]);
        $("#right_rate").html( data[5]+"%");
        var done_list="";
        var undone_list="";
        var tr_head="<tr>";
        var tr_end= "</tr>";
        var td_head= "<td>";
        var td_end= "</td>";

        for ( var i=0, count=1; i< data[2].length; i++, count++)
        {
          if( 0==( count%3)){
            done_list= done_list+ td_head+ data[2][i]+ td_end+ tr_end;
          }else if( 1==( count%3)){
            done_list= done_list+ tr_head+ td_head+ data[2][i]+ td_end;
          }else if( 2==( count%3)){
            done_list= done_list+ td_head+ data[2][i]+ td_end;
          }
        }
        $("#right_done_list").html( done_list);

        for ( var i=0, count=1; i< data[4].length; i++, count++)
        {
          if( 0==( count%3)){
            undone_list= undone_list+ td_head+ data[4][i]+ td_end+ tr_end;
          }else if( 1==( count%3)){
            undone_list= undone_list+ tr_head+ td_head+ data[4][i]+ td_end;
          }else if( 2==( count%3)){
            undone_list= undone_list+ td_head+ data[4][i]+ td_end;
          }
        }
        $("#right_undone_list").html( undone_list);

        var right_header="委员评分情况一览表";
        right_header= data[0]+right_header;
        $("#right_header").html( right_header);

      }
    });
});
</script>